package org.example.gateway.transfer;

import org.example.gateway.bean.RouteRule;
import org.example.gateway.pojo.vo.RuleVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface RuleVoTransfer {
    RuleVoTransfer INSTANCE = Mappers.getMapper(RuleVoTransfer.class);

    @Mappings({
            @Mapping(target = "createdTime", expression = "java(org.example.gateway.utils.DateUtil.formatDate(rule.getCreatedTime()))")
    })
    RuleVo mapToVO(RouteRule rule);

    List<RuleVo> mapToVOList(List<RouteRule> rules);
}
